package com.tmc.web.controller.intcar;

import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.tmc.bean.common.CommonResult;
import com.tmc.bean.common.ContextInfo;
import com.tmc.service.map.GoogleMapsServiceImpl;
import com.tmc.web.BaseController;

/**
 * 
 * @author zhang
 * @date 2018年1月12日 下午2:55:51
 */
@Controller
@RequestMapping("/intcarorder")
public class IntcarOrderController extends BaseController{
	
	
	@Autowired
	private GoogleMapsServiceImpl  googleMapsService;
	
	
	@RequestMapping("/search-carType")
	public ModelAndView search(HttpServletRequest request){
		Map<String,Object> model = new HashMap<>();
		return new ModelAndView("views/intcarorder/search-carType", model);
	}
	
	@RequestMapping("/queryAddress")
	@ResponseBody
	public String queryAddress(HttpServletRequest request, String address){
		ContextInfo context = this.getContextInfo(request);
		CommonResult result = googleMapsService.getLocations(context, address);
		return result.toJson();
	}
	
}
